home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / sbasketb.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  12KB  |  343 lines

  1. /***************************************************************************
  2.  
  3. Super Basketball memory map (preliminary)
  4. (Hold down Start 1 & Start 2 keys to enter test mode on start up;
  5.  use Start 1 to change modes)
  6.  
  7. driver by Zsolt Vasvari
  8.  
  9. MAIN BOARD:
  10. 2000-2fff RAM
  11. 3000-33ff Color RAM
  12. 3400-37ff Video RAM
  13. 3800-39ff Sprite RAM
  14. 6000-ffff ROM
  15.  
  16. ***************************************************************************/
  17.  
  18. #include "driver.h"
  19. #include "vidhrdw/generic.h"
  20. #include "cpu/m6809/m6809.h"
  21.  
  22.  
  23. extern unsigned char *sbasketb_scroll;
  24. extern unsigned char *sbasketb_palettebank;
  25. extern unsigned char *sbasketb_spriteram_select;
  26. void sbasketb_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  27. void sbasketb_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  28. WRITE_HANDLER( sbasketb_flipscreen_w );
  29.  
  30. extern struct VLM5030interface konami_vlm5030_interface;
  31. extern struct SN76496interface konami_sn76496_interface;
  32. extern struct DACinterface konami_dac_interface;
  33. WRITE_HANDLER( konami_SN76496_latch_w );
  34. WRITE_HANDLER( konami_SN76496_0_w );
  35. WRITE_HANDLER( hyperspt_sound_w );
  36. READ_HANDLER( hyperspt_sh_timer_r );
  37.  
  38.  
  39. WRITE_HANDLER( sbasketb_sh_irqtrigger_w )
  40. {
  41.     cpu_cause_interrupt(1,0xff);
  42. }
  43.  
  44.  
  45. static struct MemoryReadAddress readmem[] =
  46. {
  47.     { 0x2000, 0x3bff, MRA_RAM },
  48.     { 0x3c10, 0x3c10, MRA_NOP },    /* ???? */
  49.     { 0x3e00, 0x3e00, input_port_0_r },
  50.     { 0x3e01, 0x3e01, input_port_1_r },
  51.     { 0x3e02, 0x3e02, input_port_2_r },
  52.     { 0x3e03, 0x3e03, MRA_NOP },
  53.     { 0x3e80, 0x3e80, input_port_3_r },
  54.     { 0x3f00, 0x3f00, input_port_4_r },
  55.     { 0x6000, 0xffff, MRA_ROM },
  56.     { -1 }  /* end of table */
  57. };
  58.  
  59. static struct MemoryWriteAddress writemem[] =
  60. {
  61.     { 0x2000, 0x2fff, MWA_RAM },
  62.     { 0x3000, 0x33ff, colorram_w, &colorram },
  63.     { 0x3400, 0x37ff, videoram_w, &videoram, &videoram_size },
  64.     { 0x3800, 0x39ff, MWA_RAM, &spriteram, &spriteram_size },
  65.     { 0x3a00, 0x3bff, MWA_RAM },           /* Probably unused, but initialized */
  66.     { 0x3c00, 0x3c00, watchdog_reset_w },
  67.     { 0x3c20, 0x3c20, MWA_RAM, &sbasketb_palettebank },
  68.     { 0x3c80, 0x3c80, sbasketb_flipscreen_w },
  69.     { 0x3c81, 0x3c81, interrupt_enable_w },
  70.     { 0x3c83, 0x3c84, coin_counter_w },
  71.     { 0x3c85, 0x3c85, MWA_RAM, &sbasketb_spriteram_select },
  72.     { 0x3d00, 0x3d00, soundlatch_w },
  73.     { 0x3d80, 0x3d80, sbasketb_sh_irqtrigger_w },
  74.     { 0x3f80, 0x3f80, MWA_RAM, &sbasketb_scroll },
  75.     { -1 }  /* end of table */
  76. };
  77.  
  78. static struct MemoryReadAddress sound_readmem[] =
  79. {
  80.     { 0x0000, 0x1fff, MRA_ROM },
  81.     { 0x4000, 0x43ff, MRA_RAM },
  82.     { 0x6000, 0x6000, soundlatch_r },
  83.     { 0x8000, 0x8000, hyperspt_sh_timer_r },
  84.     { -1 }  /* end of table */
  85. };
  86.  
  87. static struct MemoryWriteAddress sound_writemem[] =
  88. {
  89.     { 0x4000, 0x43ff, MWA_RAM },
  90.     { 0xa000, 0xa000, VLM5030_data_w }, /* speech data */
  91.     { 0xc000, 0xdfff, hyperspt_sound_w },     /* speech and output controll */
  92.     { 0xe000, 0xe000, DAC_0_data_w },
  93.     { 0xe001, 0xe001, konami_SN76496_latch_w },  /* Loads the snd command into the snd latch */
  94.     { 0xe002, 0xe002, konami_SN76496_0_w },      /* This address triggers the SN chip to read the data port. */
  95.     { -1 }  /* end of table */
  96. };
  97.  
  98.  
  99.  
  100. INPUT_PORTS_START( sbasketb )
  101.     PORT_START    /* IN0 */
  102.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  103.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  104.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  105.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  106.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  107.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  108.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  109.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  110.  
  111.     PORT_START    /* IN1 */
  112.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  113.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  114.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  115.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  116.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  117.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  118.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
  119.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  120.  
  121.     PORT_START    /* IN2 */
  122.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  123.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  124.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  125.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  126.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  127.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  128.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL  )
  129.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  130.  
  131.     PORT_START    /* DSW0 */
  132.     PORT_DIPNAME( 0x03, 0x00, "Game Time" )
  133.     PORT_DIPSETTING(    0x03, "30" )
  134.     PORT_DIPSETTING(    0x01, "40" )
  135.     PORT_DIPSETTING(    0x02, "50" )
  136.     PORT_DIPSETTING(    0x00, "60" )
  137.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  138.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  139.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  140.     PORT_DIPNAME( 0x08, 0x08, "Starting Score" )
  141.     PORT_DIPSETTING(    0x08, "70-78" )
  142.     PORT_DIPSETTING(    0x00, "100-115" )
  143.     PORT_DIPNAME( 0x10, 0x00, "Ranking" )
  144.     PORT_DIPSETTING(    0x00, "Data Remaining" )
  145.     PORT_DIPSETTING(    0x10, "Data Initialized" )
  146.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  147.     PORT_DIPSETTING(    0x60, "Easy" )
  148.     PORT_DIPSETTING(    0x40, "Medium" )
  149.     PORT_DIPSETTING(    0x20, "Hard" )
  150.     PORT_DIPSETTING(    0x00, "Hardest" )
  151.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  152.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  153.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  154.  
  155.     PORT_START    /* DSW1 */
  156.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  157.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  158.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  159.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  160.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  161.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  162.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  163.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  164.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  165.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  166.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  167.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  168.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  169.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  170.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  171.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  172.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  173.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  174.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  175.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  176.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  177.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  178.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  179.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  180.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  181.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  182.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  183.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  184.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  185.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  186.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  187.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  188.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  189.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  190. INPUT_PORTS_END
  191.  
  192.  
  193.  
  194.  
  195. static struct GfxLayout charlayout =
  196. {
  197.     8,8,    /* 8*8 characters */
  198.     512,    /* 512 characters */
  199.     4,      /* 4 bits per pixel */
  200.     { 0, 1, 2, 3 }, /* the bitplanes are packed */
  201.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
  202.     { 0*4*8, 1*4*8, 2*4*8, 3*4*8, 4*4*8, 5*4*8, 6*4*8, 7*4*8 },
  203.     8*4*8     /* every char takes 32 consecutive bytes */
  204. };
  205.  
  206. static struct GfxLayout spritelayout =
  207. {
  208.     16,16,  /* 16*16 sprites */
  209.     128 * 3,/* 384 sprites */
  210.     4,      /* 4 bits per pixel */
  211.     { 0, 1, 2, 3 },        /* the bitplanes are packed */
  212.     { 0*4, 1*4,  2*4,  3*4,  4*4,  5*4,  6*4,  7*4,
  213.             8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },
  214.     { 0*4*16, 1*4*16,  2*4*16,  3*4*16,  4*4*16,  5*4*16,  6*4*16,  7*4*16,
  215.             8*4*16, 9*4*16, 10*4*16, 11*4*16, 12*4*16, 13*4*16, 14*4*16, 15*4*16 },
  216.     32*4*8    /* every sprite takes 128 consecutive bytes */
  217. };
  218.  
  219.  
  220.  
  221. static struct GfxDecodeInfo gfxdecodeinfo[] =
  222. {
  223.     { REGION_GFX1, 0, &charlayout,       0, 16 },
  224.     { REGION_GFX2, 0, &spritelayout, 16*16, 16*16 },
  225.     { -1 } /* end of array */
  226. };
  227.  
  228.  
  229. /* filenames for sample files */
  230. static const char *sbasketb_sample_names[] =
  231. {
  232.     "00.wav","01.wav","02.wav","03.wav","04.wav","05.wav","06.wav","07.wav",
  233.     "08.wav","09.wav","0a.wav","0b.wav","0c.wav","0d.wav","0e.wav","0f.wav",
  234.     "10.wav","11.wav","12.wav","13.wav","14.wav","15.wav","16.wav","17.wav",
  235.     "18.wav","19.wav","1a.wav","1b.wav","1c.wav","1d.wav","1e.wav","1f.wav",
  236.     "20.wav","21.wav","22.wav","23.wav","24.wav","25.wav","26.wav","27.wav",
  237.     "28.wav","29.wav","2a.wav","2b.wav","2c.wav","2d.wav","2e.wav","2f.wav",
  238.     "30.wav","31.wav","32.wav","33.wav",
  239.     0
  240. };
  241.  
  242. struct VLM5030interface sbasketb_vlm5030_interface =
  243. {
  244.     3580000,    /* master clock  */
  245.     255,        /* volume        */
  246.     REGION_SOUND1,    /* memory region  */
  247.     0,         /* memory size    */
  248.     0,         /* VCU            */
  249.     sbasketb_sample_names
  250. };
  251.  
  252.  
  253. static struct MachineDriver machine_driver_sbasketb =
  254. {
  255.     /* basic machine hardware */
  256.     {
  257.         {
  258.             CPU_M6809,
  259.             1400000,        /* 1.400 Mhz ??? */
  260.             readmem,writemem,0,0,
  261.             interrupt,1
  262.         },
  263.         {
  264.             CPU_Z80 | CPU_AUDIO_CPU,
  265.             14318000/4,    /* 3.5795 Mhz */
  266.             sound_readmem,sound_writemem,0,0,
  267.             ignore_interrupt,1    /* interrupts are triggered by the main CPU */
  268.         }
  269.     },
  270.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  271.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  272.     0,
  273.  
  274.     /* video hardware */
  275.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  276.     gfxdecodeinfo,
  277.     256,16*16+16*16*16,
  278.     sbasketb_vh_convert_color_prom,
  279.  
  280.     VIDEO_TYPE_RASTER,
  281.     0,
  282.     generic_vh_start,
  283.     generic_vh_stop,
  284.     sbasketb_vh_screenrefresh,
  285.  
  286.     /* sound hardware */
  287.     0,0,0,0,
  288.     {
  289.         {
  290.             SOUND_DAC,
  291.             &konami_dac_interface
  292.         },
  293.         {
  294.             SOUND_SN76496,
  295.             &konami_sn76496_interface
  296.         },
  297.         {
  298.             SOUND_VLM5030,
  299.             &sbasketb_vlm5030_interface
  300.         }
  301.     }
  302. };
  303.  
  304.  
  305.  
  306. /***************************************************************************
  307.  
  308.   Game driver(s)
  309.  
  310. ***************************************************************************/
  311.  
  312. ROM_START( sbasketb )
  313.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  314.     ROM_LOAD( "sbb_j13.bin",  0x6000, 0x2000, 0x263ec36b )
  315.     ROM_LOAD( "sbb_j11.bin",  0x8000, 0x4000, 0x0a4d7a82 )
  316.     ROM_LOAD( "sbb_j09.bin",  0xc000, 0x4000, 0x4f9dd9a0 )
  317.  
  318.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for audio cpu */
  319.     ROM_LOAD( "sbb_e13.bin",  0x0000, 0x2000, 0x1ec7458b )
  320.  
  321.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  322.     ROM_LOAD( "sbb_e12.bin",  0x0000, 0x4000, 0xe02c54da )
  323.  
  324.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  325.     ROM_LOAD( "sbb_h06.bin",  0x0000, 0x4000, 0xcfbbff07 )
  326.     ROM_LOAD( "sbb_h08.bin",  0x4000, 0x4000, 0xc75901b6 )
  327.     ROM_LOAD( "sbb_h10.bin",  0x8000, 0x4000, 0x95bc5942 )
  328.  
  329.     ROM_REGION( 0x0500, REGION_PROMS )
  330.     ROM_LOAD( "405e17",       0x0000, 0x0100, 0xb4c36d57 ) /* palette red component */
  331.     ROM_LOAD( "405e16",       0x0100, 0x0100, 0x0b7b03b8 ) /* palette green component */
  332.     ROM_LOAD( "405e18",       0x0200, 0x0100, 0x9e533bad ) /* palette blue component */
  333.     ROM_LOAD( "405e20",       0x0300, 0x0100, 0x8ca6de2f ) /* character lookup table */
  334.     ROM_LOAD( "405e19",       0x0400, 0x0100, 0xe0bc782f ) /* sprite lookup table */
  335.  
  336.     ROM_REGION( 0x10000, REGION_SOUND1 )     /* 64k for speech rom */
  337.     ROM_LOAD( "sbb_e15.bin",  0x0000, 0x2000, 0x01bb5ce9 )
  338. ROM_END
  339.  
  340.  
  341.  
  342. GAME( 1984, sbasketb, 0, sbasketb, sbasketb, 0, ROT90, "Konami", "Super Basketball" )
  343.